<%--
  Created by IntelliJ IDEA.
  User: hz
  Date: 2024/7/23
  Time: 9:44
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>我的好友</title>
    <!-- 引入 layui.css -->
    <link rel="stylesheet" href="/layui-v2.9.0/layui/css/layui.css" media="all">
    <script src="/layui-v2.9.0/layui/layui.js"></script>
    <style>
        #header{
            position: fixed;
            top: 0;
            left: 0;
            z-index: 10;


        }
        #sidebar{
            display: flex;
            flex-direction: column;
            position: fixed;
            top: 50px; /* 留出头部导航的高度 */
            bottom: 0;
            left: 0;
            width: 200px;
            height: 100%;
            padding: 10px;
            margin-top: 30px;
            z-index: 10 ;
        }
        #content {

            margin-top: 100px;
            width:51%;
            border: 1px solid gold;

        }
        #content_head_container{
            display: inline-list-item;
        }
        #sidebar_right{
            display: flex;
            flex-direction: column;
            position: fixed;
            top: 50px; /* 留出头部导航的高度 */
            bottom: 0;
            left: 0;
            width: 300px;
            height: 100%;
            padding: 10px;
            margin-top: 30px;
            margin-left: 1100px;
            z-index: 10 ;
            border: 1px solid saddlebrown;
        }
        #userHead{
            border-radius: 50%;
            overflow: hidden;
            width: 15%;
            height: 15%;
        }
        .container {
            display: flex;
            justify-content: flex-start;
            align-items: center;
            z-index: 10;
            border: none;
            /*padding: 10px;*/

        }
        .layui-nav *{
            font-size: 20px;
        }
        .layui-nav-tree.layui-nav-side{
            position: relative;
            margin-top: 10px;
        }
    </style>
</head>
<body>
<!--水平导航-->
<div id="header" class="layui-form layui-col-xs12 layui-bg-gray">
    <div class="container layui-header">
        <ul class="layui-nav layui-layout-left  layui-bg-gray" >
            <!-- 移动端显示 -->
            <li class="layui-nav-item layui-hide-xs">
                <img style="width: 40px;height: 40px; padding: 10px" src="/img/热趣部落.png" alt="图片">
            </li>
            <li class="layui-nav-item layui-hide-xs">
                <input type="text" placeholder="" class="layui-input">
                <div class="layui-input-split" style="cursor: pointer;">
                    <i class="layui-icon layui-icon-search"></i>
                </div>

            </li>
            <li class="layui-nav-item layui-show-xs-inline-block layui-hide-sm" lay-header-event="menuLeft">
                <i class="layui-icon layui-icon-spread-left"></i>
            </li>
            <li class="layui-nav-item "><a href="/forward/indexPage">首页</a></li>
            <li class="layui-nav-item "><a href="/forward/forwardUserIndexPage">个人中心</a></li>
            <li class="layui-nav-item "><a href="/forward/forwardUserSettingPage">账号设置</a></li>
            </li>
        </ul>
    </div>
</div>
<!--垂直导航-->
<div id="sidebar" class="layui-col-xs3 layui-col-xs-offset1">
    <ul  class="layui-nav layui-nav-tree layui-nav-side layui-bg-gray">
        <span class="layui-nav-item" style="padding-left: 10px">
             个人主页
        </span>
        <li class="layui-nav-item">
            <a  href="/forward/forwardUserIndexPage">
                <i class="layui-icon layui-icon-home">我的主页</i>
            </a>
        </li>
        <li class="layui-nav-item">
            <a href="/forward/forwardUserSubPage">
                <i class="layui-icon layui-icon-user">  我的关注</i>
            </a>
        </li>
        <li class="layui-nav-item">
            <a href="/forward/forwardUserTagPage">
                <i class="layui-icon layui-icon-face-smile-b">  我的兴趣</i>
            </a>
        </li>
        <%--        <li class="layui-nav-item">--%>
        <%--            <a href="interstTribal.html">--%>
        <%--                <i class="layui-icon layui-icon-group">兴趣部落 </i>--%>
        <%--            </a>--%>
        <%--        </li>--%>
        <li class="layui-nav-item">
            <a href="/forward/forwardUserFriendPage"> <i class="layui-icon layui-icon-friends"> 我的好友 </i></a>
        </li>
        <li class="layui-nav-item">
            <a href="/forward/forwardUserCommentPage"> <i class="layui-icon layui-icon-log">  我的评论</i></a>
        </li>
    </ul>
</div>
<!--内容展览-->
<div id="content" class="layui-col-xs-offset3">
    <div class="layui-bg-gray" style="padding: 16px;">
        <div id="card" class="layui-card">
            <div class="layui-input-inline layui-input-wrap">
                <div class="layui-card-header layui-input-inline">
                    <div class="layui-input-inline">
                        <p>好友列表</p>
                    </div>
                    <div class="layui-input-inline" style="margin-right: 20px;!important;"      >
                        <div class="layui-input-prefix">
                            <i class="layui-icon layui-icon-search"></i>
                        </div>
                        <input style="margin-right: 20px" type="text" class="layui-input " placeholder="搜索框" >
                    </div>
                </div>


            </div>
            <!--           内容填充-->
            <div class="layui-card-body" style="margin-top: 20px">
                <table class="layui-hide" id="ID-table-demo-setRowChecked"  lay-filter="deletePost"></table>

                <!--定义操作空间栏-->
                <script type="text/html" id="templet-demo-theads-tool">
                    <div class="layui-clear-space">
                        <a class="layui-btn layui-btn-primary layui-btn-xs" lay-event="delete">删除</a>
                    </div>
                </script>

            </div>
        </div>
    </div>
</div>

<script>
    layui.use(function(){
        var layer = layui.layer;
        var table = layui.table;
        var $ = layui.$;
        table.render({
            elem: '#ID-table-demo-setRowChecked',
            id: 'ID-table-demo',
            url: '/friend/getFriendByUid', // 此处为静态模拟数据，实际使用时需换成真实接口
            page: true,
            cols: [[
                {fixed: 'left', title:'操作', toolbar: '#templet-demo-theads-tool', width:'10%',align:'center'},
                {field:'uid', title: 'ID', unresize:true,width:'10%'},
                {field:'usex', title: '性别', width:'10%'},
                {field:'uname', title:'用户名', width:'10%'},
                {field:'uemail', title:'用户邮箱', width:'15%'},
                {field:'uaddress', title:'地址', width:'20%'},
                {field:'usignature', title:'个性签名',width: '30%'},
                {field:'uoccupation', title:'职业', width:'10%'},
            ]],
            initSort: { // 设置初始排序
                field: 'bid', // 字段名
                type: 'desc' // 倒序
            },
            limit: 5,
            limits: [5, 10]
        });
        //删除某个好友
        table.on('tool(deletePost)', function (obj) {
            console.log(obj.data);
            layer.confirm("确认删除该好友？", {
                    icon: 3,
                    btn: ['确认', '取消']
                },
                function () {
                    $.ajax({
                        url: '/friend/deleteFriendByUid?uid='+obj.data.uid,
                        success: function (res) {
                            // var cacheData = table.cache['ID-table-demo'];//获取缓存
                            layer.msg("删除成功");
                            obj.del();
                            // var rowIndex = obj.tr.attr("data-index"); //获取行索引
                            // cacheData.splice(rowIndex, 1);  //②彻底移除元素，从缓存里移除这一行
                        },
                        error: function () {
                            layer.msg("删除失败，请检查网络");
                        }
                    })
                },
                function () {
                    layer.msg('取消成功');
                }
            )
        });
    })
</script>


</body>
</html>
